/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.quickorm.helpers;

import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author aaa
 */
public class ObjectHelper {

    //得到类的所有字段
    public static Field[] getClassAllField(Class clazz) {
        List<Field> objectFieldList = new LinkedList<Field>();
        Class objectTempClass = clazz;
        while (objectTempClass != null) {
            Field[] objectATempFieldArray = objectTempClass.getDeclaredFields();
            objectFieldList.addAll(Arrays.asList(objectATempFieldArray));
            objectTempClass = objectTempClass.getSuperclass();
        }
        return objectFieldList.toArray(new Field[]{});
    }
}
